import Vue from 'vue';
import 'es6-promise/auto';
import 'babel-polyfill'; // 转换ES6+新API
import App from './App';
import router from './router/app';
import utils from './config/utils';
import store from './store';
import FastClick from 'fastclick';

import SvgIcon from './components/svg-icon.vue';
import head from './components/header.vue';
import foot from './components/footer.vue';
import selectDate from './components/select-date.vue';

if ('addEventListener' in document) {
  document.addEventListener('DOMContentLoaded', () => {
    FastClick.attach(document.body);
  }, false);
}

Vue.use(utils);

Vue.component('Icon', SvgIcon);
Vue.component('headTop', head);
Vue.component('foot', foot);
Vue.component('selectDate', selectDate);

// router.afterEach((to, from) => {
//   Vue.prototype.Loading();
// });
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {
    App
  },
  store,
  template: '<App/>'
});
